/*
 * ========THE SOLMIX PROJECT=====================================
 *
 * This is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * http://www.gnu.org/licenses/ 
 * or see the FSF site: http://www.fsf.org. 
 */

package org.solmix.services.serialize;

import java.io.Writer;

import org.solmix.services.exception.SLXException;

/**
 * @author solomon
 * @since 0.0.1
 * @version $ID$ 2011-2-7 solmix-api
 */
public interface JSParser
{

   public enum JSType
   {
      ISC( 0 ) , UN_SET( 1 );

      private final int value;

      JSType( int value )
      {
         this.value = value;
      }

      public int value()
      {
         return value;
      }

      public static JSType fromValue( int v )
      {
         for ( JSType c : JSType.values() )
         {
            if ( c.value == v )
            {
               return c;
            }
         }
         throw new IllegalArgumentException( "illegal dsresponse status" );
      }
   }

   /**
    * @return
    */
   boolean isPrettyPrint();

   /**
    * @param prettyPrint
    */
   void setPrettyPrint(boolean prettyPrint);

   /**
    * @return
    */
   String[] getFilterProperties();

   /**
    * @param filterProperties
    */
   void setFilterProperties(String[] filterProperties);

   /**
    * @return
    */
   boolean isOmitNullValues();

   /**
    * @param omitNullValues
    */
   void setOmitNullValues(boolean omitNullValues);

   /**
    * @return
    */
   boolean isJaxb();

   /**
    * @param isJaxb
    */
   void setJaxb(boolean isJaxb);

   /**
    * @return
    */
   String getImplName();

   /**
    * @param out
    * @param obj
    * @throws SLXException
    */
   void toIscJS(Writer out, Object obj) throws SLXException;

   /**
    * @param out
    * @param obj
    * @throws SLXException
    */
   void toJavaScript(Writer out, Object obj) throws SLXException;

   /**
    * @param out
    * @param obj
    * @param properties
    * @throws SLXException
    */
   void toJavaScript(Writer out, Object obj, String[] properties) throws SLXException;

   /**
    * @param out
    * @param obj
    * @param properties
    * @throws SLXException
    */
   void toIscJS(Writer out, Object obj, String[] properties) throws SLXException;

   /**
    * @param obj
    * @param properties
    * @return
    * @throws SLXException
    */
   String toIscJS(Object obj, String[] properties) throws SLXException;

   /**
    * @param obj
    * @return
    * @throws SLXException
    */
   String toJavaScript(Object obj) throws SLXException;

   /**
    * @param obj
    * @return
    * @throws SLXException
    */
   String toIscJS(Object obj) throws SLXException;

   /**
    * @param out
    * @param value
    */
   void toJSON(Writer out, Object value);

}
